package com.example.httpsocket.servlet.parentServlet;

import com.example.httpsocket.entity.MyRequest;
import com.example.httpsocket.entity.MyResponse;

/**
 * @author Huangyt
 * @version 1.0
 * @date 2020/8/27 11:56
 */
public abstract class MyHttpServlet implements MyServlet{

    @Override
    public void service(MyRequest myRequest, MyResponse myResponse) throws Exception {
        if("GET".equalsIgnoreCase(myRequest.getMethod())){
            this.doGet(myRequest, myResponse);
        }else {
            this.doPost(myRequest, myResponse);
        }
    }

    public abstract void doGet(MyRequest myRequest, MyResponse myResponse);


    public abstract void doPost(MyRequest myRequest, MyResponse myResponse);
}
